home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / modula2f.zip / WINDOWS.DEF < prev    next >
Text File  |  1992-07-02  |  4KB  |  101 lines

  1. (* Windows   BIOS Windows   1992   Chris Harshman
  2.     This module of procedures was designed to be able to use Fitted Software
  3.     Tools Modula-2 Compiler to handle the screen with pop up windows using
  4.     BIOS interupts.  They allow one to specify window color, have the cursor
  5.     stay within current window boundaries, and use fast routines that take up
  6.     less space in your executable .EXE file.  Standard Modula-2 string format
  7.     is used.  NOTE: These routines do little error checking, so be carefull
  8.     what values are entered.  These routines should not crash your program
  9.     though.  Any user input should be checked by you, the programmer before
  10.     sending it to these routines. *)
  11.  
  12. DEFINITION MODULE Windows;
  13.  
  14. FROM Screen IMPORT ScreenData;
  15.  
  16. (* Before calling any of these routines, it is suggested to use the procedures
  17.    from text for setting the screen mode and main screen colors if text is
  18.    to be printed outside of any windows. *)
  19.  
  20. TYPE Title = ARRAY[0..39] OF CHAR;
  21.      Window = RECORD
  22.                 t,b,l,r,fc,bc:CARDINAL;
  23.                 ttl:Title;
  24.                 dat:ScreenData;
  25.               END;
  26.  
  27. PROCEDURE Clw;
  28.      (* Clears the current window.  Uses color set by MakeWindow Procedure. *)
  29.  
  30. PROCEDURE WSetCursor(v, h:CARDINAL);
  31.     (* Sets the cursor to verticle row (from 0 to height), horizontal column
  32.        (from 0 to width) of the current window. *)
  33.  
  34. PROCEDURE MakeWindow(v, h, height, width, fcolor, bcolor:CARDINAL;
  35.                      title:Title; VAR w:Window);
  36.     (* Defines a window to later be put on the screen with SetWindow.  Refers
  37.        v and h to the upper left coordinates inside the window, so leave room
  38.        for a 1 character border arround the window. *)
  39.  
  40. PROCEDURE PutWindow(VAR w:Window);
  41.     (* Writes the window frame and title, clears the window, and sets it as the
  42.        current window. *)
  43.  
  44. PROCEDURE SetWindow(VAR w:Window);
  45.     (* Sets the window referenced by w on the screen as the current window.  It
  46.        is recommended to call PutWindow before calling this procedure the first
  47.        time for a window. *)
  48.  
  49. PROCEDURE RemoveWindow(VAR w:Window);
  50.     (* Removes window referenced by w from the screen.  You the programmer must
  51.        call SetWindow to change the current window. *)
  52.  
  53. PROCEDURE ScrollUp(count:CARDINAL);
  54. PROCEDURE ScrollDown(count:CARDINAL);
  55.     (* Will scroll the current window up or down the specified number of rows.
  56.        setting count to 0 will clear the current window. *)
  57.  
  58.        
  59.  
  60.     (* All Read and Write routines will print in the colors specified by the
  61.        MakeWindow procedure. *)
  62.  
  63. PROCEDURE WRead(VAR ch:CHAR);
  64.     (* Reads one character from the keyboard using BIOS calls. *)
  65.  
  66.  
  67.     (* ReadCard and ReadInt will give unpredictable results if a number
  68.        outside the ranges of the type are entered. *)
  69. PROCEDURE WReadCard(VAR n:CARDINAL);
  70.     (* Reads a cardinal number from the keyboard. If a non-number character is
  71.        entered in the input, it is ignored. (ex enter a1, the a is ignored) *)
  72.  
  73. PROCEDURE WReadInt(VAR i:INTEGER);
  74.     (* Reads an integer number from the keyboard.  If a non-number character
  75.        besides a leading - is entered, it is ignored. *)
  76.  
  77. PROCEDURE WReadString(VAR str:ARRAY OF CHAR);
  78.     (* Reads str from the keyboard using BIOS calls. *)
  79.  
  80. PROCEDURE WWrite(ch:CHAR);
  81.     (* Writes ch in the current window BIOS calls. *)
  82.  
  83. PROCEDURE WWriteCard(n, lngth:CARDINAL);
  84.     (* Writes n in a field of Length lngth.  lngth must be at least the length
  85.        of the number to be printed or the leftmost numbers will be cut off.
  86.        The length can be up to 10. *)
  87.  
  88. PROCEDURE WWriteInt(n:INTEGER; lngth:CARDINAL);
  89.     (* Writes n in a field of Length lngth.  lngth must be at least the length
  90.        of the number to print or the leftmost numbers and/or sign are cut off.
  91.        The length can be up to 10. *)
  92.  
  93. PROCEDURE WWriteString(str:ARRAY OF CHAR);
  94.     (* Writes str to the current window using BIOS calls. *)
  95.  
  96. PROCEDURE WWriteLn;
  97.     (* Does a carriage return and linefeed, puts cursor on begining of next
  98.        line as defined by the window coordinates. *)
  99.  
  100. END Windows.
  101.